# Author: Yu Bin
# Date: 2024/12/28 14:27:02
# E-mail: 853823259@qq.com
# 1、多个缺省参数的传递练习，练习多个缺省参数
def print_info(name, title="", gender=True):


    """
    :param title: 职位
    :param name: 班上同学的姓名
    :param gender: True 男生 False 女生
    """
    gender_text = "男生"
    if not gender:
        gender_text = "女生"
    print("%s%s 是 %s" % (title, name, gender_text))

print_info("小明")
print_info("老王", title="班长")
print_info("小美", gender=False)
print_info("小红","学习委员",False)

# 2、多值参数练习，元组，字典的传参拆包练习
def demo(num, *args, **kwargs):
    print(num)
    print(args)
    print(kwargs)


demo(1, 2, 3, 4, 5, name='xiaoming', age=19)
def demo(*args, **kwargs):
    print(args)
    print(kwargs)
gl_nums = (1, 2, 3)
gl_xiaoming = {"name": "小明", "age": 18}
demo(*gl_nums, **gl_xiaoming)
# 3.设计一个类，实例化1个对象，会实现下面两种行为
#
# 需求
# •一只 黄颜色 的 狗狗 叫 大黄
# •具有  汪汪叫 行为
# •具有  摇尾巴 行为
class Dog:
    def __init__(self, name, color):
        self.name = name
        self.color = color

    def shout(self):
        print(self.name + "汪汪叫")

    def swing(self):
        print(self.name + "摇尾巴")


dahuang = Dog("大黄", "yellow")
dahuang.shout()
dahuang.swing()
